//////////////////////////////////////////////////////////////////////////

#ifndef _PLAYSCREEN_H_
#define _PLAYSCREEN_H_

#ifndef _SCREEN_H_
#include "screen.h"
#endif

#ifndef _CLIENTINPUT_H_
#include "clientinput.h"
#endif

#include <string>

class GUI;
class Client;
class ServerStatePacket;
struct SDL_Surface;
class GUI_Surface;
class GUI_ImageSurface;
class GUI_Control;
class Input;
struct PlayersInfo;

class GUI_PlayScreen : public GUI_Screen
{
//////////////////////////////////////////////////////////////////////////

public:

//////////////////////////////////////////////////////////////////////////

    enum Layer {Battlefield, Menu, Settings, Statistics, LayerCount};
    enum NetworkState {NoMessagesRecieved, IDRecieved, MapRecieved};

    GUI_PlayScreen(GUI *_gui, Client* _client);
    virtual ~GUI_PlayScreen();
    
    virtual void Resize();
    virtual void Render(SDL_Surface *_mainSurface);

    void PreProcessInput();
    void PostProcessInput();
    void AddStateToRenderQueue( const ServerStatePacket& _packet );
    void UpdateServerStatistics( const PlayersInfo& _playersInfo );
    void CreateMap( const std::string& _mapName );
    void SetID( int _ID );

//////////////////////////////////////////////////////////////////////////

private:

//////////////////////////////////////////////////////////////////////////

    GUI * m_GUI;
    int m_ActiveMenu;
    NetworkState m_NetworkState;

    bool m_NeedRepaint;

    void ProcessInputResult(int _result);

    //virtual void OnEvent( Event _event, Observable* _observable ); //??

    /** Key change handler */
    virtual void OnKeyChanged(Input* _input);


    /** Mouse position change handler */
    virtual void OnMousePositionChanged(Input* _input);

    GUI_ImageSurface *m_MenuBack;

    /** Client input */
    ClientInput m_ClientInput;

    ClientInput *m_PrevInput;

    /** Client interface */
    Client* m_Client;


    int m_ID;

//////////////////////////////////////////////////////////////////////////
};


//////////////////////////////////////////////////////////////////////////

#endif

//////////////////////////////////////////////////////////////////////////
